package ext.tianma.bom.service.sourcingInterface;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import org.junit.Test;

import java.util.List;


/**
 * @description: Sourcing 调用PLM接口，将品牌相关数据传给PLM
 * @author: MaggieHao
 * @createDate: 2019/8/12 10:23
 * @updateRemark: 修改内容
 * @version: 1.0
 */
public class SourcingForPLMTest {

    @Test
    public void test() {
        String data = "[\n" +
                "    {\n" +
                "      \"brandId\": \"001\",\n" +
                "      \"chineseName\": \"品牌名称\",\n" +
                "      \"englishName\": \"brandName\",\n" +
                "      \"abbreviation\": \"bra\",\n" +
                "      \"brandState\": \"合格\",\n" +
                "      \"firstGradeCategory\": \"\",\n" +
                "      \"multilevelMaterialCategories\": \"\"\n" +
                "    },\n" +
                "    {\n" +
                "      \"brandId\": \"002\",\n" +
                "      \"chineseName\": \"品牌名称\",\n" +
                "      \"englishName\": \"brandName\",\n" +
                "      \"abbreviation\": \"bra\",\n" +
                "      \"brandState\": \"合格\",\n" +
                "      \"firstGradeCategory\": \"\",\n" +
                "      \"multilevelMaterialCategories\": \"\"\n" +
                "    },\n" +
                "    {\n" +
                "      \"brandId\": \"004\",\n" +
                "      \"chineseName\": \"品牌名称\",\n" +
                "      \"englishName\": \"brandName\",\n" +
                "      \"abbreviation\": \"bra\",\n" +
                "      \"brandState\": \"合格\",\n" +
                "      \"firstGradeCategory\": \"\",\n" +
                "      \"multilevelMaterialCategories\": \"\"\n" +
                "    }\n" +
                "  ]";
        System.out.println("data:" + data);
        //将Json转换成对象
        List<SourcingForPLMBean> sourcingForPLMBeanList = JSON.parseObject(data, new TypeReference<List<SourcingForPLMBean>>() {
        });
        SourcingForPLMReturn sourcingForPLMReturn = SourcingForPLMService.saveBrand(sourcingForPLMBeanList);
        String str = JSON.toJSONString(sourcingForPLMReturn);
        System.out.println(str);
    }

}
